package com.twu.biblioteca.domain;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: sagar
 * Date: 27/9/13
 * Time: 10:26 AM
 * To change this template use File | Settings | File Templates.
 */
public class User implements Displayable {

    private String userName;
    private String password;
    private String emailId;
    private ArrayList<Integer> bookidReserved;
    private long phoneNumber;
    public static final User NON_EXISTENT_USER = new User(){
       public boolean checkPassword(String password){
           return false;
       }
    };
    private User(){
        password=new String();
    }

    public User(String userName,String password,String emailId,long phoneNumber){
        this.userName=userName;
        this.password=password;
        this.emailId=emailId;
        bookidReserved=new ArrayList<Integer>();
        this.phoneNumber=phoneNumber;
    }
    public String getUserName() {
        return userName;
    }


    public String getEmailId() {
        return emailId;
    }

    public boolean checkPassword(String password)
    {
       return this.password.equalsIgnoreCase(password);

    }

    public void issueBook(Integer bookId){
        bookidReserved.add(bookId);
    }


    public long getPhoneNumber() {

        return phoneNumber;
    }

    @Override
    public String getDisplayText() {
        return "Username: "+userName+"\nPhone number: "+phoneNumber+"\nEmail Id:"+emailId;

    }
}
